<%@ page language="java" import="java.util.*, com.zjut.zs.util.tools.*,com.zjut.zs.userinfo.manager.*, com.zjut.zs.userinfo.dao.*,
com.zjut.zs.school.manager.*, com.zjut.zs.school.dao.*,com.zjut.zs.user.manager.*, com.zjut.zs.user.dao.*,com.zjut.zs.userstatus.manager.*, com.zjut.zs.userstatus.dao.*,
com.zjut.an.config.manager.*, com.zjut.an.config.dao.*,com.zjut.an.util.tools.*,com.zjut.an.util.system.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="renderer" content="webkit"> 
		<title>无标题文档</title>
		<link href="css/style.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
.select1 {
	border:1px solid #ccc;
	padding:8px;
	width:200px;
}
.td1 {
	width:300px;
	height:200px;
	float:left;
	margin:10px;
	padding:10px;
	border:1px solid #eee;
}
-->
</style>

	</head>
<body>
<jsp:include page="zs_uservalidate.jsp" flush="true"/>
<%
if (session.getAttribute("zsUser") == null&&session.getAttribute("admin") == null) {
	out.print("<script>alert('由于长时间未操作，系统已经自动注销，请重新登陆');</script>");
	out.print("<script>top.window.location='main.jsp';</script>");
} else {
ZsSchoolManager zsManager = (ZsSchoolManager) SpringContextUtil.getBean("ZsSchoolManager");
ZsSchool school = new ZsSchool();
school = (ZsSchool)zsManager.getDataByInstance(1,1,null,null,school).getObjects().get(0);
AnConfigManager anconfig = (AnConfigManager) SpringContextUtil.getBean("AnConfigManager");
ZsHTMLCreat html = (ZsHTMLCreat) SpringContextUtil.getBean("ZsHTMLCreat");
ZsUserManager umanager = (ZsUserManager) SpringContextUtil.getBean("ZsUserManager");
ZsUserStatusManager smanager = (ZsUserStatusManager) SpringContextUtil.getBean("ZsUserStatusManager");

ZsUser user = null;
if(session.getAttribute("admin")!=null && request.getParameter("usId")!=null) {
	String usId = request.getParameter("usId");
	user = umanager.getData(usId);
} else if (session.getAttribute("zsUser")!=null) {
	user = (ZsUser)session.getAttribute("zsUser");	
}
ZsUserStatus userstatus = smanager.getDataByUser(user);
String key = MD5.toMD5(user.getUsId().toString());
 %>

		<div class="place">
			<span>位置：</span>
			<ul class="placeul">
				<li><a href="index.jsp">首页</a></li>
				<li><a href="#">申请撤回</a></li>
			</ul>
		</div>
		<div style="width:800px;">
			<div class="td1">
				<div>申请撤回到未提交状态<div class="xline"></div>（管理员审核通过后可修改所有信息，修改后需要重新提交申请表并确认材料）</div>
				<form id="ff1" name="add1" role="form" class="form-horizontal" action="javascript:send1();"  method="post"> 
					<div class="formbody">
						<%
						if (!Status.ON.getStatus().equals(school.getScBackActive())){
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>已经关闭</button>
						<%
						} else if (Status.SENDSTATUS_YES.getStatus().equals(userstatus.getSendStatus()) && Status.CHECKSTATUS_NULL.getStatus().equals(userstatus.getCheckStatus()) ) {
						%>
						申请原因：<input id="message1" name="message1" type="text" class="dfinput" required data-rule-chinese="true" data-msg-chinese="请输入中文" value="" size="30" maxlength="30" style="width:200px;"/>
						<button type="submit" id="button" class="btn btn-primary btn-sm">申请撤回申请表</button>
						<%
						} else if (Status.SENDSTATUS_NO.getStatus().equals(userstatus.getSendStatus())){
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>已经退回</button><br>请尽快修改信息，重新提交
						<%
						} else if (Status.SENDSTATUS_BACK.getStatus().equals(userstatus.getSendStatus())){
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>已经申请退回</button><br>请等待管理员审核
						<%
						}  else if (!Status.CHECKSTATUS_NULL.getStatus().equals(userstatus.getCheckStatus()) ){
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>已经初审</button>
						<%
						} else {
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>尚未提交申请</button>
						<%
						}
						 %>
					</div>
				</form>
			</div>
			<div class="td1">
				<div>申请撤回到材料未确认状态<div class="xline"></div>（管理员审核通过后可以重新上传佐证材料，修改后需要重新确认材料）</div>
				<form id="ff2" name="add2" role="form" class="form-horizontal" action="javascript:send2();"  method="post"> 
					<div class="formbody">
						<%
						if (!Status.ON.getStatus().equals(school.getScBackActive())){
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>已经关闭</button>
						<%	
						} else if (Status.APPSTATUS_YES.getStatus().equals(userstatus.getAppStatus()) && Status.CHECKSTATUS_NULL.getStatus().equals(userstatus.getCheckStatus()) ) {
						%>
						申请原因：<input id="message2" name="message2" type="text" class="dfinput" required data-rule-chinese="true" data-msg-chinese="请输入中文" value="" size="30" maxlength="30"  style="width:200px;"/>
						<button type="submit" id="button" class="btn btn-primary btn-sm">申请撤回材料确认</button>
						<%
						} else if (Status.APPSTATUS_NO.getStatus().equals(userstatus.getAppStatus()) ||Status.APPSTATUS_NOTIME.getStatus().equals(userstatus.getAppStatus())){
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>已经撤回</button><br>请尽快修改材料，重新确认材料
						<%
						} else if (Status.APPSTATUS_BACK.getStatus().equals(userstatus.getAppStatus())){
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>已经申请撤回</button><br>请等待管理员审核
						<%
						}  else if (!Status.CHECKSTATUS_NULL.getStatus().equals(userstatus.getCheckStatus()) ){
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>已经初审</button>
						<%
						} else {
						%>
						<button type="submit" id="button" class="btndisable btn-primary btn-sm" disabled>尚未确认材料</button>
						<%
						}
						 %>
					</div>
				</form>
			</div>
		</div>
		 
		<div style="margin:50px;"><%out.print(anconfig.getSingleConfigInfoByName("申请撤回需知")); %></div>

<script src="../plugins/assets/plugins/jquery-3.5.1.min.js" type="text/javascript"></script>  
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.validate.js" type="text/javascript"></script>
<script src="../plugins/assets/plugins/jquery-validation-1.14.0/dist/jquery.metadata.js" type="text/javascript"></script>
<script src="js/formvalidate.js" type="text/javascript"></script>
<script src="../admin/js/publicManager.js" type="text/javascript" charset="utf-8"></script> 
		
		<script type="text/javascript">

var loactionurl = 'zs_sendback.jsp';
			
function send1() {
	if(confirm("‘申请撤回提交’后请等待管理员审核通过。是否确认提交？")) {
		var message = $("#message1").val();
		$.ajax({
	    	cache: false,
	    	type: "GET",
	        url:'../zsUserStatusSendBack.action?usId=<%=user.getUsId()%>&key=<%=key%>&message='+message+'&randnum='+Math.floor(Math.random()*1000000),
	        data:{},// 你的formid
	        async: false,
	        error: function(request) {
	        	alert("提交有误");
	        },
	        success: function(data) {
	            alert("提交成功");		            
	            if ("undefined" != typeof loactionurl) {
	            	top.window.location = 'main.jsp';
	            }
	        }
	    });
	}
}
function send2() {
	if(confirm("‘申请撤回材料确认’后请等待管理员审核通过。是否确认提交？")) {
		var message = $("#message2").val();
		$.ajax({
	    	cache: false,
	    	type: "GET",
	        url:'../zsUserAppSendBack.action?usId=<%=user.getUsId()%>&key=<%=key%>&message='+message+'&randnum='+Math.floor(Math.random()*1000000),
	        data:{},// 你的formid
	        async: false,
	        error: function(request) {
	        	alert("提交有误");
	        },
	        success: function(data) {
	            alert("提交成功");		            
	            if ("undefined" != typeof loactionurl) {
	            	top.window.location = 'main.jsp';
	            }
	        }
	    });
	}
}
		</script>
<%} %>	
		
	</body>

</html>